package com.km.service.impl;

import com.km.service.ExampleService;
import com.km.web.ExampleController;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * <p></p>
 * Created by zhezhiyong@163.com on 2017/9/1.
 */
@Slf4j
@Service
public class ExampleServiceImpl implements ExampleService {
    @Override
    @Async("mySimpleAsync")
    public void testThreadLocal() throws InterruptedException {
        Thread.sleep(3000);
        String info = MDC.get("test");
        log.info("执行异步任务: {}", info);
        String value = ExampleController.parent.get();
        log.info("执行异步任务: {}", value);
    }
}
